package LeetCode.NumOffer;

/**
 * 二进制中1的个数
 * @author lumin
 * @date 2022/04/30 19:52
 **/
public class NumOffer15 {
    public int hammingWeight(int n) {
        int count = 0;
        for (int i = 0; i < 32; i++) {
            if((n & (1 << i)) != 0){
                count++;
            }

        }
        return count;
    }
}